<template>
  <!-- 预警决策主页-带电检测模块 -->
  <div class="charge">
    <div class="charge-top">
      <div class="charge-top-item">
        <div class="charge-top-item-text green">应测设备</div>
        <div class="charge-top-item-value" @click="goYingCDevicePage()">{{newelectricTotal.yctotal}}</div>
      </div>
      <div class="charge-top-item">
        <div class="charge-top-item-text red">已测设备</div>
        <div class="charge-top-item-value" @click="goYiCDevicePage()">{{newelectricTotal.yictotal}}</div>
      </div>
      <div class="charge-top-item">
        <div class="charge-top-item-text blue">异常设备</div>
        <div class="charge-top-item-value" @click="goYCDevicePage()">{{newelectricData[0].ycsb}}</div>
      </div>
      <div class="charge-top-item">
        <div class="charge-top-item-text orange">专家未审核</div>
        <div class="charge-top-item-value" @click="gozjDevicePage()">0</div>
      </div>
    </div>
    <div class="charge-bottom">
      <ChargeBar :electricData="newelectricData" :CurrentOrg="newCurrentOrg" />
    </div>
  </div>
</template>

<script lang="ts">
import { Component, Vue, Prop } from "vue-property-decorator";
import ChargeBar from "../../commponents/ChargeBar/index.vue";
//loadsh
import lodash from "lodash";
@Component({
  components: {
    ChargeBar,
  },
})
export default class extends Vue {
  // 当前地市信息
  @Prop({ default: () => [] })
  CurrentOrg;
  // 地市名
  @Prop({ default: () => [] })
  dzLoginName;
  // 带电检测装备总数
  @Prop({ default: () => [] })
  electricTotal;
  // 带电检测异常装备数据
  @Prop({ default: () => [] })
  electricData;

  get newCurrentOrg() {
    let CurrentOrg = this.CurrentOrg;
    return CurrentOrg;
  }

  get newdzLoginName() {
    let dzLoginName = this.dzLoginName;
    return dzLoginName;
  }

  get newelectricTotal() {
    let electricTotal = this.electricTotal;
    return electricTotal;
  }

  get newelectricData() {
    let electricData = this.electricData;
    return electricData;
  }
  // 应测设备
  goYingCDevicePage() {
    // let url = "http://10.193.23.21:28883/epribigdata/jsp/tg_zt/xyddjc/ycsb.jsp?jclx=0&jcly=0&ssds=";
    // if (this.newCurrentOrg.SSDSBM == "8a1ea5c64bdebad1014bdebc4cbf0001") {
    //   //省公司
    //   window.open(url + null);
    // } else {
    //   //地市公司
    //   window.open(url + this.newCurrentOrg.SSDSBM);
    // }

    // iframe嵌套
    let list = "";
    if (this.newCurrentOrg.SSDSBM == "8a1ea5c64bdebad1014bdebc4cbf0001") {
      //省公司
      list = "jclx=0&jcly=0&ssds=";
    } else {
      //地市公司
      list = "jclx=0&jcly=0&ssds=" + this.newCurrentOrg.SSDSBM;
    }
    let url="http://10.193.23.21:28883/epribigdata/jsp/tg_zt/xyddjc/ycsb.jsp?" +
          list;
     window.open(url, "_blank")
    // this.$router.push({
    //   path: "xyddjc",
    //   query: {
    //     list: list,
    //     urlType:'ddjc'
    //   },
    // });
  }

  // 已测设备链接跳转页面
  private goYiCDevicePage() {
    // let url =
    //   "http://10.193.23.21:28883/epribigdata/jsp/tg_zt/xyddjc/ycsb.jsp?jczt=0&ssds=";
    // if (this.newCurrentOrg.SSDSBM == "8a1ea5c64bdebad1014bdebc4cbf0001") {
    //   //省公司
    //   window.open(url + null);
    // } else {
    //   //地市公司
    //   window.open(url + this.newCurrentOrg.SSDSBM);
    // }

    // iframe嵌套
    let list = "";
    if (this.newCurrentOrg.SSDSBM == "8a1ea5c64bdebad1014bdebc4cbf0001") {
      //省公司
      list = "jczt=0&ssds=";
    } else {
      //地市公司
      list = "jczt=0&ssds=" + this.newCurrentOrg.SSDSBM;
    }
    let url="http://10.193.23.21:28883/epribigdata/jsp/tg_zt/xyddjc/ycsb.jsp?" +
          list;
     window.open(url, "_blank")
    // this.$router.push({
    //   path: "xyddjc",
    //   query: {
    //     list: list,
    //     urlType:'ddjc'
    //   },
    // });
  }

  // 异常设备链接跳转页面
  private goYCDevicePage() {
    let date = new Date();
    let month =
      Number(date.getMonth() + 1) < 10
        ? "0" + Number(date.getMonth() + 1)
        : Number(date.getMonth() + 1);
    let day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
    let time = date.getFullYear() + "-" + month + "-" + day;
    // let url =
    // "http://10.193.23.21:28883/epribigdata/jsp/tg_zt/xyddjc/ycsb.jsp?jczt=0&ssds=";
    // if (this.newCurrentOrg.SSDSBM == "8a1ea5c64bdebad1014bdebc4cbf0001") {
    //   //省公司
    //   window.open(
    //     url + null + "&jcly=0&startDate=2019-01-01&endDate=" + time + "&zjjl=1"
    //   );
    // } else {
    //   //地市公司
    //   window.open(
    //     url +
    //       this.newCurrentOrg.SSDSBM +
    //       "&jcly=0&startDate=2019-01-01&endDate=" +
    //       time +
    //       "&zjjl=1"
    //   );
    // }

    // iframe嵌套
    let list = "";
    if (this.newCurrentOrg.SSDSBM == "8a1ea5c64bdebad1014bdebc4cbf0001") {
      //省公司
      list =
        "jczt=0&ssds=" +
        null +
        "&jcly=0&startDate=2019-01-01&endDate=" +
        time +
        "&zjjl=1";
    } else {
      //地市公司
      list =
        "jczt=0&ssds=" +
        this.newCurrentOrg.SSDSBM +
        "&jcly=0&startDate=2019-01-01&endDate=" +
        time +
        "&zjjl=1";
    }
    let url="http://10.193.23.21:28883/epribigdata/jsp/tg_zt/xyddjc/ycsb.jsp?" +
          list;
     window.open(url, "_blank")
    // this.$router.push({
    //   path: "xyddjc",
    //   query: {
    //     list: list,
    //     urlType:'ddjc'
    //   },
    // });
  }
  // 专家未审核
  gozjDevicePage() {
    let date = new Date();
    let month =
      Number(date.getMonth() + 1) < 10
        ? "0" + Number(date.getMonth() + 1)
        : Number(date.getMonth() + 1);
    let day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
    let time = date.getFullYear() + "-" + month + "-" + day;
    // let url =
    //   "http://10.193.23.21:28883/epribigdata/jsp/tg_zt/xyddjc/ycsb.jsp?jczt=0&ssds=";
    // if (this.newCurrentOrg.SSDSBM == "8a1ea5c64bdebad1014bdebc4cbf0001") {
    //   //省公司
    //   window.open(
    //     url + null + "&jcly=0&jcjl=1&startDate=2019-01-01&endDate=" + time
    //   );
    // } else {
    //   //地市公司
    //   window.open(
    //     url +
    //       this.newCurrentOrg.SSDSBM +
    //       "&jcly=0&jcjl=1&startDate=2019-01-01&endDate=" +
    //       time
    //   );
    // }

    // iframe嵌套
    let list = "";
    if (this.newCurrentOrg.SSDSBM == "8a1ea5c64bdebad1014bdebc4cbf0001") {
      //省公司
      list =
        "jczt=0&ssds=" +
        null +
        "&jcly=0&jcjl=1&startDate=2019-01-01&endDate=" +
        time;
    } else {
      //地市公司
      list =
        "jczt=0&ssds=" +
        this.newCurrentOrg.SSDSBM +
        "&jcly=0&jcjl=1&startDate=2019-01-01&endDate=" +
        time;
    }
    let url="http://10.193.23.21:28883/epribigdata/jsp/tg_zt/xyddjc/ycsb.jsp?" +
          list;
     window.open(url, "_blank")
    // this.$router.push({
    //   path: "xyddjc",
    //   query: {
    //     list: list,
    //     urlType:'ddjc'
    //   },
    // });
  }

  // 开关柜超声波/开关柜暂态地/红外测温/GIS特高频/GIS超声波跳转页面
  private goAlarmPage(tail: string) {
    // let url =
    //   "http://10.193.23.21:28883/epribigdata/jsp/tg_zt/xyddjc/ycsb.jsp?jczt=0&ssds=";
    // if (this.newCurrentOrg.SSDSBM == "8a1ea5c64bdebad1014bdebc4cbf0001") {
    //   //省公司
    //   window.open(url + null + "&jclx=" + tail);
    // } else {
    //   //地市公司
    //   window.open(url + this.newCurrentOrg.SSDSBM + "&jclx=" + tail);
    // }

    // iframe嵌套
    let list = "";
    if (this.newCurrentOrg.SSDSBM == "8a1ea5c64bdebad1014bdebc4cbf0001") {
      //省公司
      list = "jczt=0&ssds=" + null + "&jclx=" + tail;
    } else {
      //地市公司
      list = "jczt=0&ssds=" + this.newCurrentOrg.SSDSBM + "&jclx=" + tail;
    }
    let url="http://10.193.23.21:28883/epribigdata/jsp/tg_zt/xyddjc/ycsb.jsp?" +
          list;
     window.open(url, "_blank")
    // this.$router.push({
    //   path: "xyddjc",
    //   query: {
    //     list: list,
    //     urlType:'ddjc'
    //   },
    // });
  }
}
</script>

<style lang="scss" scoped>
.charge {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  // padding-top: 6%;
  &-top {
    width: 100%;
    height: 34%;
    margin-top: 6%;
    // background-color: pink;
    display: flex;
    justify-content: space-around;
    align-items: center;
    &-item {
      width: 0.88rem;
      height: 1.32rem;
      background-image: url("../../../../assets/img/WarningToSolve/warning_bg4.png");
      background-size: 100% 100%;
      background-repeat: no-repeat;
      background-position: center;
      display: flex;
      flex-direction: column;
      .green {
        color: #01da8c;
      }
      .red {
        color: #f3652b;
      }
      .blue {
        color: #0d7acf;
      }
      .orange {
        color: #e09b0f;
      }
      &-text {
        width: 100%;
        height: 50%;
        // background-color: gray;
        text-align: center;
        padding-top: 30%;
      }
      &-value {
        width: 100%;
        flex: 1;
        // background-color: greenyellow;
        text-align: center;
        padding-top: 10%;
        cursor: pointer;
      }
    }
  }
  &-bottom {
    width: 100%;
    flex: 1;
    // background-color: powderblue;
  }
}
</style>

